package com.ijpay.wxpay.model;

import com.ijpay.wxpay.constans.RespConstants;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @program:
 * @description: 服务返回实体
 * @author: Taurus
 * @create: 2019-10-14 16:37
 **/
@Data
@Builder
@NoArgsConstructor
@ApiModel(value = "通用应答报文")
public class RespVO {
    @ApiModelProperty(value = "应答编码", required = true, example = "0000", position = 1)
    private String respCode;

    @ApiModelProperty(value = "描述信息", required = true, example = "SUCCESS", position = 2)
    private String respDesc;

    public RespVO(String respCode, String respDesc) {
        this.respCode = respCode;
        this.respDesc = respDesc;
    }

    public static RespVO error() {
        return new RespVO(RespConstants.FAILURE, RespConstants.MSG_INTERNAL_ERROR);
    }

    public static RespVO error(String respDesc) {
        return new RespVO(RespConstants.FAILURE, respDesc);
    }

    public static RespVO error(String respCode, String respDesc) {
        return new RespVO(respCode, respDesc);
    }

    public static RespVO ok() {
        return new RespVO(RespConstants.SUCCESS, RespConstants.MSG_QUERY_OK);
    }

    public static RespVO ok(String respDesc) {
        return new RespVO(RespConstants.SUCCESS, respDesc);
    }

}